package com.henry.Client;

import com.henry.model.Question;

import java.io.*;
import java.util.ArrayList;
import java.util.List;

public class ClientData {
    public static List<Question> questions = new ArrayList<>();
    private static ObjectInputStream ois = null;
    private static ObjectOutputStream oos = null;

    public static void dataInput(String str) throws IOException, ClassNotFoundException {
        ois = new ObjectInputStream(new FileInputStream(str));
        questions.addAll((List<Question>)ois.readObject());
    }
    public static void dataOutput() throws IOException {
        oos = new ObjectOutputStream(new FileOutputStream("e:/questions.txt"));
        oos.writeObject(questions);
    }
    public static void dataClose() throws IOException {
        oos.close();
        ois.close();
    }
}
